/* 写法1 这是采用外部构造的方式创建map */
var map = new ol.Map({});
var target = document.getElementById('map');
var layer = new ol.layer.Tile({
    source: new ol.source.Stamen({
        layer: "watercolor"
    })
});
var view = new ol.View({
    center: ol.proj.transform(
        [-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857'
    ),
    zoom: 12
});
map.setTarget(target);
map.addLayer(layer);
map.setView(view);

/* 写法2 这是采用一般写法，直接在构造里传入需要的参数 */
var map1 = new ol.Map({
    target: "map_1",
    view: new ol.View({
        center: new ol.proj.transform(
            [1, 2], "EPSG:4326", "EPSG:3857"
        ),
        zoom: 8
    }),
    layers: [new ol.layer.Tile({
        source: new ol.source.Stamen({
            layer: "watercolor"
        })
    })]
});